package com.meadin.agent.utils;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

public class FileUtil {

	
	  public static void  WriteStringToFile(String filePath ,String inputStr) {
		  
		  FileUtil.judeFileExists(new File(filePath));
		  
	        try {
	            PrintWriter pw = new PrintWriter(new FileWriter(filePath,true));
	            pw.print(inputStr);
	            pw.close();
	        } catch (IOException e) {
	            
	            e.printStackTrace();
	        }
	        
	    }
	  
	  
	     public static void judeFileExists(File file) {
	    	 
	         if (file.exists()) {
	             System.out.println("file exists");
	         } else {
	             System.out.println("file not exists, create it ...");
	             try {
	                 file.createNewFile();
	             } catch (IOException e) {
	                 // TODO Auto-generated catch block
	                 e.printStackTrace();
	             }
	         }
	 
	     }

}